from TurtleWorld import *
from math import *
 
world=TurtleWorld()
bob=Turtle()
bob.delay = .001
 
#----------------------------TRIANGLES----------------------------#

def eq_tri(t, size=100, rotate=0):
    for i in range(3):
        t.fd(size)
        t.rt(120)
        t.rt(rotate)
    print "Equilateral Triangle, with Size:", size, "and Rotation:", rotate
    
    
#--------------------------QUADRILATERALS-------------------------#

def para(t, width=100, height=100, angle=120, rotate=0):
    for i in range(2):
        t.fd(height)
        t.rt(angle)
        t.fd(width)
        t.rt(180-angle)
    print "Parallelogram, with Width:", width, "Height:", height, "Angle:", angle, "and Rotation:", rotate

def rectSpiral(t, max=1000, angle=180, inc=10):
    count = 2
    while count<=max:
        rect(t, count)
        count+=inc
        t.rt(angle)     
     
     
def rhom(t, size=100, angle=120, rotate=0):
    for i in range(2):
        t.fd(size)
        t.rt(angle)
        t.fd(size)
        t.rt(180-angle)
    print "Rhombus, with Size:", size, "Angle:", angle, "and Rotation:", rotate
  
def rect(t, width=100, height=100, rotate=90):
    print "Rectangle, with Width:", width, "Height:", height, "and Rotation:", rotate
    for i in range(2):
        t.fd(width)
        t.rt()
        t.fd(width)
        t.fd(width)
        t.rt()
        
    
        
        
    

def square(t, size=100, rotate=0):
    t.rt(rotate)
    t.fd(100)
    t.rt(rotate)
    t.fd(100)
    t.rt(rotate)
    t.fd(100)
    t.rt(rotate)
    t.fd(100)
    t.rt(rotate)
    print "Sqaure, with Size:", size, "and Rotation:", rotate
 
#------------------------------MOVEMENT---------------------------#

def line(t, x=100, y=100):
	dist = sqrt(x**2+y**2)
	angle = degrees(atan(y/float(x)))
	t.lt(angle)
	t.fd(dist)
	t.rt(angle)
	print "Line to a point X:", x, "over and Y:", y, "up"
  
def move(t, x=100, y=380): 
	dist = sqrt(x**2+y**2)
	angle = degrees(atan(y/float(x)))
	t.pu()
	t.lt(angle)
	t.fd(dist)
	t.rt(angle)
	t.pd()
	
	
		
	
    
	print "Move without marking to a point X:", x, "over and Y:", y, "up"
     
#------------------------------OTHER SHAPES------------------------#
"""
Build any other shape functions you want.
Some Ideas:
    Right Triangles (sss, sas, etc)
    Arbitrary Triangles
    Circle
    Arcs
    Go Wild!
    
Bonus for working or challenging functions...no penalty for trying something
"""

#------------------------------TEST-------------------------------#

line(bob, 50, 100)

wait_for_user()